import {
		ref,
	} from 'vue'
	let code = ref(60)
	let falg = ref(true)

	function handlerCode() {
		if (!falg.value) {
			uni.$u.toast(`请等倒计时结束${code.value}`)
			return
		}
		falg.value = false
		let time = setInterval(() => {
			code.value--
			if (code.value < 0) {
				falg.value = true
				code.value = 60
				clearInterval(time)
			}
		}, 1000)
	}
	export {
		code,
		handlerCode
	}
